
<!-- <script type="text/javascript" src="__PUBLIC__/Home/js/jquery-1.10.2.min.js"></script> -->
<include file="App/Home/View/Public/header.html" />
<script type="text/javascript" src="__PUBLIC__/Home/js/clipboard.min.js"></script>
<style>
    .icon1{width:20px !important;
        height:20px !important;
        background-image:url(/Public/Admin/images/add.png);
        background-repeat:no-repeat;
        background-position:center;
        float:left;
        line-height: 35px;
        margin-top:6px;
    }
    .icon2{width:20px !important;
        height:20px !important;
        background-image:url(/Public/Admin/images/reduce.png);
        background-repeat:no-repeat;
        background-position:center;
        float:left;
        line-height: 35px;
        margin-top:6px;
    }
    .tree{ cursor:pointer;}
    .td{ height:35px; line-height:35px; text-align:left; padding-left:100px}
    .treenew {
        min-height:20px;
        padding:19px;
        margin-bottom:20px;
        background-color:transparent;
        /*border:1px solid #ccc;*/
        -webkit-border-radius:4px;
        -moz-border-radius:4px;
        border-radius:4px;
        -webkit-box-shadow:inset 0 1px 1px rgba(0, 0, 0, 0.05);
        -moz-box-shadow:inset 0 1px 1px rgba(0, 0, 0, 0.05);
        box-shadow:inset 0 1px 1px rgba(0, 0, 0, 0.05)
    }
    .treenew li {
        list-style-type:none;
        margin:0;
        padding:10px 5px 0 5px;
        position:relative
    }
    .treenew li::before, .treenew li::after {
        content:'';
        left:-20px;
        position:absolute;
        right:auto
    }
    .treenew li::before {
        border-left:1px solid #999;
        bottom:50px;
        height:100%;
        top:0;
        width:1px
    }
    .treenew li::after {
        border-top:1px solid #999;
        height:20px;
        top:25px;
        width:25px
    }
    .treenew li span {
        -moz-border-radius:5px;
        -webkit-border-radius:5px;
        border:1px solid #999;
        border-radius:5px;
        display:inline-block;
        padding:3px 8px;
        text-decoration:none
    }
    .treenew li.parent_li>span {
        cursor:pointer
    }
    .treenew>ul>li::before, .treenew>ul>li::after {
        border:0
    }
    .treenew li:last-child::before {
        height:25px
    }
    .treenew li.parent_li>span:hover, .treenew li.parent_li>span:hover+ul li span {
        background:#eee;
        border:1px solid #94a0b4;
        color:#000
    }
    .treenew ul{
        display: block;
        list-style-type: disc;
    //-webkit-margin-before: 1em;
    //-webkit-margin-after: 1em;
        -webkit-margin-start: 0px;
        -webkit-margin-end: 0px;
        -webkit-padding-start: 40px;
    }
</style>
<div id="account-main" role="main">
	<div class="container account-content">
		<div class="row">
			<include file="App/Home/View/Public/left.html" />
			<div class="col-xs-9 account-right"> 
				<div class="my-assets">
					<div class="content-head">我的邀请</div>
					<div class="myactive">

						<p class="myactive-title">我的邀请链接：</p>
						<div class="content-blue1">
							<form class="form-horizontal">
								<div class="row ">
									<span class="col-xs-3 control-label label-title">
										{$config.invite_rule}</span>
								</div>
								<div class="row "> 
									<a href="http://{$_SERVER['SERVER_NAME']}{:U('Reg/reg',array('Member_id'=>session('USER_KEY_ID')))}">
									<input type="text" style="width: 700px;text-align: center;cursor:pointer" class="myactive-input"
										name="InviteUrl" id="inviteUrl" 
										value="http://{$_SERVER['SERVER_NAME']}{:U('Reg/reg',array('Member_id'=>session('USER_KEY_ID')))}"></a>

								</div>
								<div class="row">
									<p style="background: #008fff;" 
										class="btn btn-wrap btn-myactive zeroclipboard-is-hover"
										type="submit" id="submitInvite" data-clipboard-text="http://{$_SERVER['SERVER_NAME']}{:U('Reg/reg',array('Member_id'=>session('USER_KEY_ID')))}">复制链接</p><!-- <button class="btn" data-clipboard-text="测试1">点击测试1</button> -->
									<!-- <span id="copyLinkSuccess"
										style="vertical-align: bottom; margin-left: 10px; visibility: hidden">复制成功</span> -->
								</div>
							</form>
						</div>
						<p class="myactive-title">推荐图：</p>
                        <div class="treenew well">
                                            <ul>
                                                <li class="parent_li" path="1">
                                                    <span class="tree" onclick="getsuser(this);" data-key="on" style="color:black">
                                                    <img src="__PUBLIC__/Admin/images/add.png" id="adimg"/><img src="__PUBLIC__/Admin/images/head2.png" /><em class="account">{$member.email}</em> - 注册日期：{$member.reg_time|date="Y-m-d H:i:s",###}</span>
                                                </li>
                                            </ul>
                                        </div>
						<div class="tablediv">
							<!-- <div class="blue-wrap">
								<h2 class="myactive-text">返利</h2>
							</div>
							<table class="table">
								<thead>
									<tr>

										<th>币种</th>
										<th>返利</th>

									</tr>
								</thead>
								<tbody>
								</tbody>
							</table> -->
							<div class="blue-wrap">
								<h2 class="myactive-text myactive-text2">邀请好友</h2>
							</div>
							<table class="table">
								<thead>
									<tr>
										<th>邀请好友</th>
										<th>状态</th>
										<th>注册时间</th>
									</tr>
								</thead>
								<tbody>
									<volist name="my_invit" id="vov">
			                            <tr>
			                                <td>{$vov['email']}</td>
			                                <td>有效</td>
			                                <td>{$vov['reg_time']}</td>
			                            </tr>
			                        </volist>
								</tbody>
							</table>

						</div>
						<div class="row new-page">
							<div class="col-sm-12 text-center">
								<ul class="pagination"></ul>
							</div>
						</div>
					</div>
				</div>


			</div>
		</div>
	</div>
</div> 
<script type="text/javascript">

    $('.treenew li:has(ul)').addClass('parent_li').find(' > span').attr('title', 'Collapse this branch');
    function getsuser(ob) {
        //alert($(ob).parent().attr("path"));
		
        if($(ob).children('#adimg').attr('src') == "__PUBLIC__/Admin/images/add.png"){
            $(ob).children('#adimg').attr('src',"__PUBLIC__/Admin/images/minus.png")
            $(ob).children('#adimg').addClass("imgClass")
        }else{
            $(ob).children('#adimg').attr('src',"__PUBLIC__/Admin/images/add.png")
            $(ob).children('#adimg').addClass("imgClass")	
        }

        var children = $(ob).parent('li.parent_li').find(' > ul > li');
        if (children.is(":visible")) {
            children.hide('fast');
            $(ob).attr('title', 'Expand this branch').find(' > i').addClass('icon-plus-sign').removeClass('icon-minus-sign');
        } else if( $(ob).attr("index") == 1 ){
            children.show('fast');
            return false;
        }else {
            children.show('fast');
            $(ob).attr('index','1');
            var asd=$(ob).find("em").text();
			var path = $(ob).parent().attr("path");
			
            // alert(asd);
            var url = "{:U('User/getInivt')}"
            var ob = $(ob);
            $.post(url,{'username':asd,'path':path},function(data){
			
                if(data['status']==1){
				
						ob.attr('title', 'Collapse this branch').find(' > i').addClass('icon-minus-sign').removeClass('icon-plus-sign');
						var str = "<ul>"
						for(var i=0;i<data.member.length;i++){
							str += " <li class='parent_li' path='"+data['path']+"' ><span class='tree' onclick='getsuser(this);' style='color:black' data-key='on'><img src='__PUBLIC__/Admin/images/add.png' id='adimg'/><img src='__PUBLIC__/Admin/images/head2.png' /><em class='account'>"+data['member'][i]['email']+"</em> - 注册日期："+data['member'][i]['reg_time']+"</span></li>";
						}
						str += "</ul>";
						ob.after(str);
					
					
                    
                }else{
				
                	layer.msg('无下线会员');
                }
            })

        }
        // $(ob).stopPropagation();
    }

</script>
<!-- <script src="__PUBLIC__/Home/js/ZeroClipboard.min.js"></script> -->
<script type="text/javascript" src="__PUBLIC__/Home/js/jquery1.4.2.js"></script>  
<!-- <script type="text/javascript" src="__PUBLIC__/Home/js/jquery.zclip.js"></script>   -->

<script type="text/javascript">  
$(document).ready(function(){  
   var clipboard = new Clipboard('.btn'); 
   clipboard.on('success', function(e) {
	   console.log(e);
        alert("复制成功！")
	    });
   clipboard.on('error', function(e) {
	           console.log(e);
	           alert("复制失败！请手动复制")
	 	});
})
</script>  

<script>
         //    $("#inviteUrl").focus(function () {
         //        this.select();
         //    });
         //    var client = new ZeroClipboard(document.getElementById("submitInvite"));
         //    var inviteUrl = $("#inviteUrl").val();
         //    ZeroClipboard.setData("text/plain", inviteUrl);
	        // $("#submitInvite").mouseover(function () {
	        //     ZeroClipboard.setData("text/plain", inviteUrl);
	        // });
         //    $("#submitInvite").click(function (e) {
         //        e.preventDefault();
         //    	$("#copyLinkSuccess").css({visibility:"visible"});
            // });

            


        </script>



<include file="App/Home/View/Public/footer.html" />

